﻿

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
<!--MODEL-->
	<pre style="font-family: Consolas; font-size: 13; color: black; background: white;"><span 
		style="color:blue;">using</span>&nbsp;System;
<span style="color:blue;">using</span>&nbsp;System.Collections.Generic;
<span style="color:blue;">using</span>&nbsp;System.Linq;
<span style="color:blue;">using</span>&nbsp;System.Web;
<span style="color:blue;">using</span>&nbsp;System.Web.Mvc;
 
<span style="color:blue;">namespace</span>&nbsp;InnovaApp.Portals.MVC4Portal.Models
{
	<span style="color:blue;">public</span>&nbsp;<span style="color:blue;">class</span>&nbsp;<span 
		style="color:#2b91af;">DropDownListModel</span>&nbsp;:&nbsp;<span 
		style="color:#2b91af;">_Models_Base</span>
	{
		<span style="color:blue;">public</span>&nbsp;<span style="color:blue;">int</span>&nbsp;MyChoice&nbsp;{&nbsp;<span 
		style="color:blue;">get</span>;&nbsp;<span style="color:blue;">set</span>;&nbsp;}
		<span style="color:blue;">public</span>&nbsp;<span style="color:#2b91af;">IEnumerable</span>&lt;<span 
		style="color:#2b91af;">SelectListItem</span>&gt;&nbsp;MyList&nbsp;{&nbsp;<span 
		style="color:blue;">get</span>;&nbsp;<span style="color:blue;">set</span>;&nbsp;}
	}
}
</pre>
<!--/MODEL-->
<hr />
<!--Controller-->
	<pre style="font-family: Consolas; font-size: 13; color: black; background: white;"><span 
		style="color:blue;">using</span>&nbsp;System;
<span style="color:blue;">using</span>&nbsp;System.Collections.Generic;
<span style="color:blue;">using</span>&nbsp;System.Linq;
<span style="color:blue;">using</span>&nbsp;System.Web;
<span style="color:blue;">using</span>&nbsp;System.Web.Mvc;
<span style="color:blue;">using</span>&nbsp;InnovaApp.Portals.MVC4Portal.Models;
<span style="color:blue;">using</span>&nbsp;INNOVACALL.Framework.Common.MVCHelpers;
<span style="color:blue;">using</span>&nbsp;InnovaApp.Layers.DataLayer;
<span style="color:blue;">using</span>&nbsp;InnovaApp.Layers.ResourcesLayer.Properties;
 
<span style="color:blue;">namespace</span>&nbsp;InnovaApp.Portals.MVC4Portal.Controllers
{
	<span style="color:blue;">public</span>&nbsp;<span style="color:blue;">class</span>&nbsp;<span 
		style="color:#2b91af;">DropDownListController</span>&nbsp;:&nbsp;<span 
		style="color:#2b91af;">_Controllers_Base</span>&lt;<span 
		style="color:#2b91af;">DropDownListModel</span>&gt;
	{
		<span style="color:blue;">protected</span>&nbsp;<span style="color:blue;">override</span>&nbsp;<span 
		style="color:blue;">void</span>&nbsp;Initialize(System.Web.Routing.<span 
		style="color:#2b91af;">RequestContext</span>&nbsp;requestContext)
		{
			eMethodBase&nbsp;=&nbsp;<span style="color:#a31515;">&quot;InnovaApp.Portals.MVC4Portal.Controllers.DropDownListController&quot;</span>;
			specificCssCollection&nbsp;=&nbsp;<span style="color:blue;">new</span>&nbsp;<span 
		style="color:blue;">string</span>[]&nbsp;{&nbsp;<span style="color:#a31515;">&quot;_FormCommon.css&quot;</span>,&nbsp;<span 
		style="color:#a31515;">&quot;Views/DropDownList.css&quot;</span>&nbsp;};
			specificJSCollection&nbsp;=&nbsp;<span style="color:blue;">null</span>;
			dynamicJSCollection&nbsp;=&nbsp;<span style="color:blue;">new</span>&nbsp;<span 
		style="color:blue;">string</span>[]&nbsp;{&nbsp;<span style="color:#a31515;">&quot;/ScriptsG/DropDownList.js&quot;</span>&nbsp;};
			specificJqueryJSCollection&nbsp;=&nbsp;<span style="color:blue;">new</span>&nbsp;<span 
		style="color:blue;">string</span>[]&nbsp;{&nbsp;<span style="color:#a31515;">&quot;InnovacallJS/DropDownList/DropDownList.js&quot;</span>&nbsp;};
			toAddToDocumentReady&nbsp;=&nbsp;<span style="color:blue;">null</span>;
			toAddToFileDocumentReady&nbsp;=&nbsp;<span style="color:blue;">null</span>;
			externalCss&nbsp;=&nbsp;<span style="color:blue;">null</span>;
 
			<span style="color:blue;">base</span>.Initialize(requestContext);
		}
 
		[<span style="color:#2b91af;">HttpGet</span>,&nbsp;<span style="color:#2b91af;">CacheManager</span>(<span 
		style="color:#2b91af;">enCacheMode</span>.NoCache)]&nbsp;<span 
		style="color:green;">//Manage&nbsp;your&nbsp;cache</span>
		<span style="color:blue;">public</span>&nbsp;<span style="color:#2b91af;">ActionResult</span>&nbsp;Index()
		{
			<span style="color:green;">//NEVER&nbsp;USES&nbsp;VIEW&nbsp;BAG&nbsp;AGAIN&nbsp;!</span>
			<span style="color:green;">//ViewBag.Message&nbsp;=&nbsp;&quot;Modify&nbsp;this&nbsp;template&nbsp;to&nbsp;kick-start&nbsp;your&nbsp;ASP.NET&nbsp;MVC&nbsp;application.&quot;;</span>
			{
				<span style="color:blue;">using</span>&nbsp;(<span 
		style="color:#2b91af;">DataRepositories</span>&nbsp;_dataContext&nbsp;=&nbsp;<span 
		style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">DataRepositories</span>())
				{
					<span style="color:blue;">base</span>.InitView(
						<span style="color:#2b91af;">Resources</span>.View_Home_PageTitle,
						<span style="color:blue;">string</span>.Empty,
						specificCssCollection,
						specificJSCollection,
						dynamicJSCollection,
						specificJqueryJSCollection,
						toAddToDocumentReady,
						toAddToFileDocumentReady,
						externalCss,
						_dataContext);
 
					ContentData.MyChoice&nbsp;=&nbsp;1;
					ContentData.MyList&nbsp;=&nbsp;_dataContext.InnoAppUser_Rep.GetAll().OrderBy(x&nbsp;=&gt;&nbsp;x.Username).Select(x&nbsp;=&gt;&nbsp;<span 
		style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">SelectListItem</span>()&nbsp;{&nbsp;Value&nbsp;=&nbsp;x.Id.ToString(),&nbsp;Text&nbsp;=&nbsp;x.Username,&nbsp;Selected&nbsp;=&nbsp;<span 
		style="color:blue;">false</span>&nbsp;}).AsEnumerable();
				}
				<span style="color:blue;">return</span>&nbsp;View(ContentData);
			}
		}
	}
}
</pre>
<!--/Controller-->
<hr />
<!--View-->
	<pre style="font-family: Consolas; font-size: 13; color: black; background: white;"><span 
		style="background: yellow;">@model&nbsp;</span>InnovaApp.Portals.MVC4Portal.Models.<span 
		style="color:#2b91af;">DropDownListModel</span>
<span style="background: yellow;">@</span>Html.DropDownListFor(m&nbsp;=&gt;&nbsp;m.MyChoice,&nbsp;Model.MyList)</pre>
<!--/View-->


</body>
</html>
